{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">评论列表</li>
            <li><a href="{:url('admin/newsflash/add_com',['id'=>$id])}" >添加评论</a></li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <form class="layui-form layui-form-pane" action="{:url('admin/newsflash/com_list')}" method="get">
                    <input type="hidden" name="id" value="{$id}">
                    <div class="layui-inline">
                        <label class="layui-form-label">关键字</label>
                        <div class="layui-input-inline">
                            <input type="text" name="keyword" value="{$keyword}" placeholder="请输入(id,评论人或内容)" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn">搜索</button>
                    </div>
                </form>
                <hr>
                <form action="" method="post" class="ajax-form">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 15px;"><input type="checkbox" class="check-all"></th>
                        <th style="width: 30px;">ID</th>
                        <th>评论人</th>
                        <th>评论内容</th>
                        <th>评论时间</th>
                        <th>评论状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="com_list" id="vo"}
                    <tr>
                        <td><input type="checkbox" name="ids[]" value="{$vo.id}"></td>
                        <td>{$vo.id}</td>
                        <td>{$vo.user}</td>
                        <th>{$vo.content}</th>
                        <td>{$vo.create_time}</td>
                        <td class="layui-form">
                            <input type="checkbox" name="online_type" value="{$vo.id}" lay-skin="switch"
                                   lay-text="ON|OFF" lay-filter="changeStatus"
                                   {if $vo.status == 1}
                                   checked
                                   {/if}
                            >
                        </td>
                        <td>
                            <a href="{:url('admin/knowledge/isTop',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">置顶</a>
                            <a href="{:url('admin/knowledge/com_delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                    <button type="button" class="layui-btn layui-btn-danger layui-btn-small ajax-action" data-action="{:url('admin/knowledge/com_delete')}">删除选中</button>
                </form>
                {$com_list->render()}
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}

<script type="text/javascript">
    //监听指定开关
    form.on('switch(changeStatus)', function (data) {
        changeComStatus(data);
    });
</script>
{/block}

